//
//  SelectView.m
//  GiftItems
//
//  Created by lanou3g on 15/9/18.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "SelectView.h"
#import "SelectCollectionViewCell.h"
#import "SelectModel.h"
@implementation SelectView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self collectionViewAndReusableView];
    }
    return self;
}
//创建集合视图和增广视图
- (void)collectionViewAndReusableView{
    //创建一个布局对象
    UICollectionViewFlowLayout *classcificationCVFlayout = [[UICollectionViewFlowLayout alloc] init];
    //设置集合视图行间距
    classcificationCVFlayout.minimumLineSpacing = 10;
    //设置集合视图每个item之间的间隔
    classcificationCVFlayout.minimumInteritemSpacing = 15;
    //设置集合视图中每个item的大小
    classcificationCVFlayout.itemSize = CGSizeMake((kWidth - 25 * 2 - 10 *3) / 4.5, (kWidth - 30 * 2 - 10 *3) / 4.5 + 20);
    //设置layer的大小(居上,居左,居下,居右)
    classcificationCVFlayout.sectionInset = UIEdgeInsetsMake(5, 25, 0, 25);
    //设置集合视图的增广视图大小
    classcificationCVFlayout.headerReferenceSize = CGSizeMake(self.bounds.size.width, 50);
    //创建集合视图
    self.ClassificationCV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height - 70) collectionViewLayout:classcificationCVFlayout];
    self.ClassificationCV.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.ClassificationCV];
}


@end
